
$(document).ready(function() {

    $(function () {
        $("#login").click(function () {
            let userId = $("#login-username").val();
            let userPwd = $("#login-password").val();
                $.ajax({
                    url: '/user/login',
                    type: 'get',
                    dataType: 'json',
                    async:false,
                    data:{"userId":userId,"userPwd":userPwd.toString()},
                    success: function (data) {
                            let userName = data.userName;
                            localStorage.setItem('userId',userId);
                            localStorage.setItem('state','0');
                            localStorage.setItem('userName',userName);

                            window.location.href=("../web/loading.html");
                    },
                    error:function (){
                        swal({title:"账号或密码错误请重新输入！",type:"error"});
                    }
                });
        })


    });

})
function jump(){
    window.location.href=("../index.html?userId="+localStorage.getItem("userId")+"&" +encodeURI(localStorage.getItem("userName")));
}